package com.xiaoxin.smartbi.bizmq;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class MqInit {

    public static void main(String[] args)  {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("localhost");
        Connection connection = null;
        try {
            connection = factory.newConnection();
            Channel channel = connection.createChannel();
            channel.exchangeDeclare("code_copy_exchange", "direct");
            channel.queueDeclare("code_copy_queue", true, false, false, null);
            channel.queueBind("code_copy_queue", "code_copy_exchange", "code_copy_routingKey");
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
